/*
* @Author DingWen
* @Description Mixins 使用案例二
* @Date 10:00 2021/2/7
**/

void main() {
  Doctor doctor = Doctor();
  doctor.cure();
  doctor.study();

  Developer developer = Developer();
  developer.study();
  developer.coding();

  Teacher teacher = Teacher();
  teacher.study();
  teacher.teaching();
}

class Person {
  study() => print('study');
}


class Doctor extends Person with Cure {}

class Developer extends Person with Coding {}

class Teacher extends Person with Teaching {}

//class Cure {
//  cure() => print('cure');
//}
//
//class Teaching {
//  teaching() => print('teaching');
//}
//
//class Coding {
//  // 需要Mixins的类无法定义构造函数
////  Coding(){}
//  coding() => print('coding');
//}

mixin Cure {
  cure() => print('cure');
}

mixin Teaching {
  teaching() => print('teaching');
}

mixin Coding on Person{ //添加限制条件只有Person有coding这个技能
  // 需要Mixins的类无法定义构造函数
//  Coding(){}
  coding() => print('coding');
  @override
  study() {
    //调用父类的study()
    super.study();
    print('children');
  }
}

//class Dog with Coding{
//
//}
